#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2021/12/17 17:35
# @USER    : Shengji He
# @File    : nacPET2muMap.py
# @Software: PyCharm
# @Version  : Python-
# @TASK:
from pycore.tikzeng import *
from pycore.blocks import *


def ResnetGenerator():
    num_filters = 32
    arch = [
        to_head('..'),
        to_cor(),
        to_begin(),

        # input
        to_input('./nacPET.jpg'),
        # to_input('../examples/fcn8s/cats.jpg'),
        to_ConvRelu(name='conv1', s_filer='{{X, Y, Z}}', n_filer=num_filters, offset="(0,0,0)", to="(0,0,0)", width=3,
                    height=40,
                    depth=40, caption='Conv1'),

        to_ConvRelu(name='conv2', s_filer='{{X/2, Y/2, Z}}', n_filer=num_filters * 2, offset="(2,0,0)",
                    to="(conv1-east)",
                    width=4.5, height=35, depth=35, caption='Conv2'),

        to_ConvRelu(name='conv3', s_filer='{{X/4, Y/4, Z}}', n_filer=num_filters * 4, offset="(2,0,0)",
                    to="(conv2-east)",
                    width=6, height=30, depth=30, caption='Conv3'),

        to_ConvRelu(name='conv4', s_filer='{{X/8, Y/8, Z}}', n_filer=num_filters * 8, offset="(2,0,0)",
                    to="(conv3-east)",
                    width=7.5, height=23, depth=23, caption='Conv4'),

        *CascadeResBlock(4, 'ResBlock', botton='conv4', top='res_top', s_filer="", n_filer=num_filters * 8,
                         offset="(1.8,0,0)", width=7.5, height=23, depth=23, opacity=0.8),

        to_DeConvRelu(name='upconv3', s_filer='{{X/4, Y/4, Z}}', n_filer=num_filters * 4, offset="(2,0,0)",
                      to="(res_top-east)",
                      width=6, height=30, depth=30, caption='DeConv3', ),

        to_DeConvRelu(name='upconv2', s_filer='{{X/2, Y/2, Z}}', n_filer=num_filters * 2, offset="(2,0,0)",
                      to="(upconv3-east)",
                      width=4.5, height=35, depth=35, caption='DeConv2', ),

        to_DeConvRelu(name='upconv1', s_filer='{{X, Y, Z}}', n_filer=num_filters, offset="(2,0,0)", to="(upconv2-east)",
                      width=3,
                      height=40, depth=40, caption='DeConv1', ),

        to_ConvSoftMax('out', s_filer='Output', n_filer=1, offset="(2,0,0)", to="(upconv1-east)", width=1,
                       height=40, depth=40, caption='OutConv', ),
        to_output('./CT.jpg', of='out', pos=10),

        to_connection("conv1", "conv2"),
        to_connection("conv2", "conv3"),
        to_connection("conv3", "conv4"),

        to_connection("res_top", "upconv3"),
        to_connection("upconv3", "upconv2"),
        to_connection("upconv2", "upconv1"),
        to_connection("upconv1", "out"),
        # to_connection("conv4", "rsb1"),
        # to_connection("rsb1", "rsb2"),
        # to_connection("rsb2", "rsb3"),
        # to_connection("rsb3", "rsb4"),

        to_end(),
    ]

    to_generate(arch, 'ResnetGenerator.tex')

    pass


def UNet3DCTP3():
    num_filters = 64
    scale = 0.3
    arch = [
        to_head('..'),
        to_cor(),
        to_begin(),

        # input
        to_input('./nacPET.jpg'),
        # to_input('../examples/fcn8s/cats.jpg'),
        to_ConvRelu(name='conv1', s_filer='{{X, Y, Z}}', n_filer=num_filters, offset="(0,0,0)", to="(0,0,0)",
                    width=3, height=40, depth=40, caption='Conv1'),

        to_ConvRelu(name='pool1', s_filer='', n_filer=num_filters, offset="(2,0,0)", to="(conv1-east)",
                    width=3, height=35, depth=35, caption='Pool1'),

        to_ConvRelu(name='conv2', s_filer='{{X/2, Y/2, Z}}', n_filer=num_filters * 2, offset="(0.5,0,0)",
                    to="(pool1-east)", width=4.5, height=35, depth=35, caption='Conv2'),

        to_ConvRelu(name='pool2', s_filer='', n_filer=num_filters * 2, offset="(2,0,0)",
                    to="(conv2-east)", width=4.5, height=30, depth=30, caption='Pool2'),

        to_ConvRelu(name='conv3', s_filer='{{X/4, Y/4, Z}}', n_filer=num_filters * 4, offset="(0.5,0,0)",
                    to="(pool2-east)", width=6, height=30, depth=30, caption='Conv3'),

        to_ConvRelu(name='pool3', s_filer='', n_filer=num_filters * 4, offset="(2,0,0)",
                    to="(conv3-east)", width=6, height=23, depth=23, caption='Pool3'),

        to_ConvConvRelu(name='conv4', s_filer='{{X/8, Y/8, Z}}', n_filer=(num_filters * 8, num_filters * 8),
                        offset="(0.5,0,0)",
                        to="(pool3-east)", width=(7.5, 7.5), height=23, depth=23, caption='Conv4'),

        to_DeConvRelu(name='up3', s_filer='{{X/4, Y/4, Z}}', n_filer=num_filters * 4, offset="(2,0,0)",
                      to="(conv4-east)", width=6, height=30, depth=30, caption='Up3', ),
        to_Sum('upsum3', offset="(1.7,0,0)", to="(up3-east)", radius=2.5),
        to_ConvRelu(name='upconv3', s_filer='{{X/4, Y/4, Z}}', n_filer=num_filters * 4, offset="(1.2,0,0)",
                    to="(upsum3-east)", width=6, height=30, depth=30, caption='UpConv3'),

        to_DeConvRelu(name='up2', s_filer='{{X/2, Y/2, Z}}', n_filer=num_filters * 2, offset="(2,0,0)",
                      to="(upconv3-east)", width=4.5, height=35, depth=35, caption='Up2', ),
        to_Sum('upsum2', offset="(1.9,0,0)", to="(up2-east)", ),
        to_ConvRelu(name='upconv2', s_filer='{{X/2, Y/2, Z}}', n_filer=num_filters * 2, offset="(1.4,0,0)",
                    to="(upsum2-east)", width=4.5, height=35, depth=35, caption='UpConv2'),

        to_DeConvRelu(name='up1', s_filer='{{X, Y, Z}}', n_filer=num_filters, offset="(2,0,0)", to="(upconv2-east)",
                      width=3, height=40, depth=40, caption='Up1', ),
        to_Sum('upsum1', offset="(2.1,0,0)", to="(up1-east)", ),
        to_ConvRelu(name='upconv1', s_filer='{{X, Y, Z}}', n_filer=num_filters, offset="(1.6,0,0)", to="(upsum1-east)",
                    width=3, height=40, depth=40, caption='UpConv1'),

        to_ConvSoftMax('out', s_filer='Output', n_filer=1, offset="(2,0,0)", to="(upconv1-east)", width=1,
                       height=40, depth=40, caption='OutConv', ),
        to_output('./CT.jpg', of='out', pos=10),

        to_connection("conv1", "pool1"),
        # to_connection("pool1", "conv2"),
        to_connection("conv2", "pool2"),
        # to_connection("pool2", "conv3"),
        to_connection("conv3", "pool3"),
        # to_connection("pool3", "conv4"),

        to_connection("conv4", "up3"),
        to_connection("up3", "upsum3"),
        to_skip(of="conv3", to="upsum3", pos=1.25, pos2=1.25 + (30 / 2 - 2.5) * scale),
        to_connection("upsum3", "upconv3"),

        to_connection("upconv3", "up2"),
        to_connection("up2", "upsum2"),
        to_skip(of="conv2", to="upsum2", pos=1.25, pos2=1.25 + (35 / 2 - 2.5) * scale),
        to_connection("upsum2", "upconv2"),

        to_connection("upconv2", "up1"),
        to_connection("up1", "upsum1"),
        to_skip(of="conv1", to="upsum1", pos=1.25, pos2=1.25 + (40 / 2 - 2.5) * scale),
        to_connection("upsum1", "upconv1"),

        to_connection("upconv1", "out"),
        # to_connection("conv4", "rsb1"),
        # to_connection("rsb1", "rsb2"),
        # to_connection("rsb2", "rsb3"),
        # to_connection("rsb3", "rsb4"),

        to_end(),
    ]

    to_generate(arch, 'UNet3DCTP3.tex')

    pass


def SinoUnet():
    """or ARLUnet"""
    num_filters = 16
    scale = 0.3
    arch = [
        to_head('..'),
        to_cor(),
        to_begin(),

        # input
        to_input('./nacPET.jpg'),
        # to_input('../examples/fcn8s/cats.jpg'),
        to_ResBlock(name='conv1', s_filer='{I}', n_filer=num_filters, offset="(0,0,0)", to="(0,0,0)",
                    width=3, height=40, depth=40, caption='ARL-1'),

        to_ConvRelu(name='pool1', s_filer='', n_filer=num_filters, offset="(2,0,0)", to="(conv1-east)",
                    width=3, height=35, depth=35, caption='Pool1'),

        to_ResBlock(name='conv2', s_filer='I/2', n_filer=num_filters * 2, offset="(0.5,0,0)",
                    to="(pool1-east)", width=4.5, height=35, depth=35, caption='ARL-2'),

        to_ConvRelu(name='pool2', s_filer='', n_filer=num_filters * 2, offset="(2,0,0)",
                    to="(conv2-east)", width=4.5, height=30, depth=30, caption='Pool2'),

        to_ResBlock(name='conv3', s_filer='I/4', n_filer=num_filters * 4, offset="(0.5,0,0)",
                    to="(pool2-east)", width=6, height=30, depth=30, caption='ARL-3'),

        to_ConvRelu(name='pool3', s_filer='', n_filer=num_filters * 4, offset="(2,0,0)",
                    to="(conv3-east)", width=6, height=23, depth=23, caption='Pool3'),

        to_ResBlock(name='conv4', s_filer='I/8', n_filer=num_filters * 8, offset="(0.5,0,0)",
                    to="(pool3-east)", width=7.5, height=23, depth=23, caption='ARL-4'),

        to_ResBlock(name='conv5', s_filer='I/8', n_filer=num_filters * 8, offset="(0.5,0,0)",
                    to="(conv4-east)", width=7.5, height=23, depth=23, caption='ARL-5'),

        to_DeConvRelu(name='up3', s_filer='I/4', n_filer=num_filters * 4, offset="(2,0,0)",
                      to="(conv5-east)", width=6, height=30, depth=30, caption='Up3', ),
        to_Cat2('upsum3', offset="(1.7,0,0)", to="(up3-east)", radius=2.5),
        to_ResBlock(name='upconv3', s_filer='I/4', n_filer=num_filters * 4, offset="(1.2,0,0)",
                    to="(upsum3-east)", width=6, height=30, depth=30, caption='ARL-6'),

        to_DeConvRelu(name='up2', s_filer='I/2', n_filer=num_filters * 2, offset="(2,0,0)",
                      to="(upconv3-east)", width=4.5, height=35, depth=35, caption='Up2', ),
        to_Cat2('upsum2', offset="(1.9,0,0)", to="(up2-east)", ),
        to_ResBlock(name='upconv2', s_filer='I/2', n_filer=num_filters * 2, offset="(1.4,0,0)",
                    to="(upsum2-east)", width=4.5, height=35, depth=35, caption='ARL-7'),

        to_DeConvRelu(name='up1', s_filer='I', n_filer=num_filters, offset="(2,0,0)", to="(upconv2-east)",
                      width=3, height=40, depth=40, caption='Up1', ),
        to_Cat2('upsum1', offset="(2.1,0,0)", to="(up1-east)", ),
        to_ResBlock(name='upconv1', s_filer='I', n_filer=num_filters, offset="(1.6,0,0)", to="(upsum1-east)",
                    width=3, height=40, depth=40, caption='ARL-8'),

        to_ConvSoftMax('out', s_filer='Output', n_filer=1, offset="(2,0,0)", to="(upconv1-east)", width=1,
                       height=40, depth=40, caption='OutConv', ),

        to_output('./CT.jpg', of='out', pos=10),

        to_connection("conv1", "pool1"),
        # to_connection("pool1", "conv2"),
        to_connection("conv2", "pool2"),
        # to_connection("pool2", "conv3"),
        to_connection("conv3", "pool3"),
        # to_connection("pool3", "conv4"),

        to_connection("conv4", "conv5"),
        to_connection("conv5", "up3"),
        to_connection("up3", "upsum3"),
        to_skip(of="conv3", to="upsum3", pos=1.25, pos2=1.25 + (30 / 2 - 2.5) * scale),
        to_connection("upsum3", "upconv3"),

        to_connection("upconv3", "up2"),
        to_connection("up2", "upsum2"),
        to_skip(of="conv2", to="upsum2", pos=1.25, pos2=1.25 + (35 / 2 - 2.5) * scale),
        to_connection("upsum2", "upconv2"),

        to_connection("upconv2", "up1"),
        to_connection("up1", "upsum1"),
        to_skip(of="conv1", to="upsum1", pos=1.25, pos2=1.25 + (40 / 2 - 2.5) * scale),
        to_connection("upsum1", "upconv1"),

        to_connection("upconv1", "out"),
        # to_connection("conv4", "rsb1"),
        # to_connection("rsb1", "rsb2"),
        # to_connection("rsb2", "rsb3"),
        # to_connection("rsb3", "rsb4"),

        to_end(),
    ]

    to_generate(arch, 'SinoUnet.tex')

    pass


def RSABUnetV1():
    """or ARLUnet"""
    num_filters = 32
    scale = 0.3
    arch = [
        to_head('..'),
        to_cor(),
        to_begin(),

        # input
        to_input('./nacPET.jpg'),
        to_ConvRelu(name='conv1', s_filer='{{X, Y, Z}}', n_filer=num_filters, offset="(0,0,0)", to="(0,0,0)", width=3,
                    height=40, depth=40, caption='Conv1'),

        to_ConvRelu(name='conv2', s_filer='{{X/2, Y/2, Z}}', n_filer=num_filters * 2, offset="(2,0,0)",
                    to="(conv1-east)", width=4.5, height=35, depth=35, caption='Conv2'),

        to_ConvRelu(name='conv3', s_filer='{{X/4, Y/4, Z}}', n_filer=num_filters * 4, offset="(2,0,0)",
                    to="(conv2-east)", width=6, height=30, depth=30, caption='Conv3'),

        to_ConvRelu(name='conv4', s_filer='{{X/8, Y/8, Z}}', n_filer=num_filters * 8, offset="(2,0,0)",
                    to="(conv3-east)", width=7.5, height=23, depth=23, caption='Conv4'),

        *CascadeResBlock(2, 'ARLBlock', botton='conv4', top='res_top', s_filer="", n_filer=num_filters * 8,
                         offset="(1.8,0,0)", width=7.5, height=23, depth=23, opacity=0.8),

        to_DeConvRelu(name='up3', s_filer='{{X/4, Y/4, Z}}', n_filer=num_filters * 4, offset="(2,0,0)",
                      to="(res_top-east)", width=6, height=30, depth=30, caption='DeConv3', ),
        to_Cat2('upsum3', offset="(1.7,0,0)", to="(up3-east)", radius=2.5),
        to_ConvRelu(name='upconv3', s_filer='{{X/4, Y/4, Z}}', n_filer=num_filters * 4, offset="(1.2,0,0)",
                    to="(upsum3-east)", width=6, height=30, depth=30, caption='Conv4'),

        to_DeConvRelu(name='up2', s_filer='{{X/2, Y/2, Z}}', n_filer=num_filters * 2, offset="(2,0,0)",
                      to="(upconv3-east)", width=4.5, height=35, depth=35, caption='DeConv2', ),
        to_Cat2('upsum2', offset="(1.9,0,0)", to="(up2-east)", ),
        to_ConvRelu(name='upconv2', s_filer='{{X/2, Y/2, Z}}', n_filer=num_filters * 2, offset="(1.4,0,0)",
                    to="(upsum2-east)", width=4.5, height=35, depth=35, caption='Conv5'),

        to_DeConvRelu(name='up1', s_filer='{{X, Y, Z}}', n_filer=num_filters, offset="(2,0,0)", to="(upconv2-east)",
                      width=3, height=40, depth=40, caption='DeConv1', ),
        to_Cat2('upsum1', offset="(2.1,0,0)", to="(up1-east)", ),
        to_ConvRelu(name='upconv1', s_filer='{{X, Y, Z}}', n_filer=num_filters, offset="(1.6,0,0)", to="(upsum1-east)",
                    width=3, height=40, depth=40, caption='Conv6'),

        to_ConvSoftMax('out', s_filer='Output', n_filer=1, offset="(2,0,0)", to="(upconv1-east)", width=1,
                       height=40, depth=40, caption='OutConv', ),
        to_output('./CT.jpg', of='out', pos=10),

        to_connection("conv1", "conv2"),
        to_connection("conv2", "conv3"),
        to_connection("conv3", "conv4"),

        to_connection("res_top", "up3"),
        to_connection("up3", "upsum3"),
        to_skip(of="conv3", to="upsum3", pos=1.25, pos2=1.25 + (30 / 2 - 2.5) * scale),
        to_connection("upsum3", "upconv3"),

        to_connection("upconv3", "up2"),
        to_connection("up2", "upsum2"),
        to_skip(of="conv2", to="upsum2", pos=1.25, pos2=1.25 + (35 / 2 - 2.5) * scale),
        to_connection("upsum2", "upconv2"),

        to_connection("upconv2", "up1"),
        to_connection("up1", "upsum1"),
        to_skip(of="conv1", to="upsum1", pos=1.25, pos2=1.25 + (40 / 2 - 2.5) * scale),
        to_connection("upsum1", "upconv1"),

        to_connection("upconv1", "out"),
        # to_connection("conv4", "rsb1"),
        # to_connection("rsb1", "rsb2"),
        # to_connection("rsb2", "rsb3"),
        # to_connection("rsb3", "rsb4"),

        to_end(),
    ]

    to_generate(arch, 'RSABUnetV1.tex')

    pass


def NLayerDiscriminator():
    """or ARLUnet"""
    num_filters = 32
    scale = 0.3
    arch = [
        to_head('..'),
        to_cor(),
        to_begin(),

        # input
        # to_input('./Dinput.jpg'),
        # to_input('./nacPET.jpg', to="(-3,1.5,0)", name='input1', width=10, height=6),
        # to_input('./CT.jpg', to="(-3,-4.5,0)", name='input2', width=10, height=6),
        # to_ConvRelu(name='conv1', s_filer='{{X, Y, Z}}', n_filer=num_filters, offset="(0,0,0)", to="(0,0,0)", width=3,
        #             height=40, depth=40, caption='Conv1'),

        to_Conv(name='input', s_filer='{{X, Y, Z}}', n_filer=3, offset="(0,0,0)", to="(-4,0,0)", width=1,
                height=40, depth=40, caption='Input'),

        to_ConvRelu(name='conv1', s_filer='{{X/2, Y/2, Z/2}}', n_filer=num_filters * 2, offset="(0,0,0)",
                    to="(0,0,0)", width=4.5, height=35, depth=35, caption='Conv1'),

        to_ConvRelu(name='conv2', s_filer='{{X/4, Y/4, Z/4}}', n_filer=num_filters * 4, offset="(4,0,0)",
                    to="(conv1-east)", width=6, height=30, depth=30, caption='Conv2'),

        to_ConvRelu(name='conv3', s_filer='{{X/8, Y/8, Z/8}}', n_filer=num_filters * 8, offset="(4,0,0)",
                    to="(conv2-east)", width=7.5, height=23, depth=23, caption='Conv3'),

        to_Conv(name='out', s_filer='{{X/8, Y/8, Z/8}}', n_filer=1, offset="(4,0,0)", to="(conv3-east)",
                width=1, height=23, depth=23, caption='Prediction'),

        to_connection("input", "conv1"),
        # to_connection("input2", "conv1"),
        to_connection("conv1", "conv2"),
        to_connection("conv2", "conv3"),
        to_connection("conv3", "out"),

        to_end(),
    ]

    to_generate(arch, 'NLayerDiscriminator.tex')

    pass


def ForPatent():
    """or ARLUnet"""
    num_filters = 32
    scale = 0.3
    arch = [
        to_head('..'),
        to_cor(),
        to_begin(),

        # input
        # to_input('./nacPET.jpg'),
        to_Conv(name='input', s_filer='{{X, Y, Z}}', n_filer=2, offset="(0,0,0)", to="(-2,0,0)", width=1,
                    height=40, depth=40, caption='Input'),

        to_ConvRelu(name='conv1', s_filer='{{X, Y, Z}}', n_filer=num_filters, offset="(0,0,0)", to="(0,0,0)", width=3,
                    height=40, depth=40, caption='Conv1'),

        to_ConvRelu(name='conv2', s_filer='{{X/2, Y/2, Z/2}}', n_filer=num_filters * 2, offset="(2,0,0)",
                    to="(conv1-east)", width=4.5, height=35, depth=35, caption='Conv2'),

        to_ConvRelu(name='conv3', s_filer='{{X/4, Y/4, Z/4}}', n_filer=num_filters * 4, offset="(2,0,0)",
                    to="(conv2-east)", width=6, height=30, depth=30, caption='Conv3'),

        to_ConvRelu(name='conv4', s_filer='{{X/8, Y/8, Z/8}}', n_filer=num_filters * 8, offset="(2,0,0)",
                    to="(conv3-east)", width=7.5, height=23, depth=23, caption='Conv4'),

        *CascadeResBlock(2, 'ARLBlock', botton='conv4', top='res_top', s_filer="", n_filer=num_filters * 8,
                         offset="(1.8,0,0)", width=7.5, height=23, depth=23, opacity=0.8),

        to_DeConvRelu(name='up3', s_filer='{{X/4, Y/4, Z/4}}', n_filer=num_filters * 4, offset="(2,0,0)",
                      to="(res_top-east)", width=6, height=30, depth=30, caption='DeConv3', ),
        to_Cat2('upsum3', offset="(1.7,0,0)", to="(up3-east)", radius=2.5),
        to_ConvRelu(name='upconv3', s_filer='{{X/4, Y/4, Z/4}}', n_filer=num_filters * 4, offset="(1.2,0,0)",
                    to="(upsum3-east)", width=6, height=30, depth=30, caption='Conv4'),

        to_DeConvRelu(name='up2', s_filer='{{X/2, Y/2, Z}/2}', n_filer=num_filters * 2, offset="(2,0,0)",
                      to="(upconv3-east)", width=4.5, height=35, depth=35, caption='DeConv2', ),
        to_Cat2('upsum2', offset="(1.9,0,0)", to="(up2-east)", ),
        to_ConvRelu(name='upconv2', s_filer='{{X/2, Y/2, Z/2}}', n_filer=num_filters * 2, offset="(1.4,0,0)",
                    to="(upsum2-east)", width=4.5, height=35, depth=35, caption='Conv5'),

        to_DeConvRelu(name='up1', s_filer='{{X, Y, Z}}', n_filer=num_filters, offset="(2,0,0)", to="(upconv2-east)",
                      width=3, height=40, depth=40, caption='DeConv1', ),
        to_Cat2('upsum1', offset="(2.1,0,0)", to="(up1-east)", ),
        to_ConvRelu(name='upconv1', s_filer='{{X, Y, Z}}', n_filer=num_filters, offset="(1.6,0,0)", to="(upsum1-east)",
                    width=3, height=40, depth=40, caption='Conv6'),

        to_ConvSoftMax('out', s_filer='Output', n_filer=1, offset="(2,0,0)", to="(upconv1-east)", width=1,
                       height=40, depth=40, caption='OutConv', ),
        # to_output('./CT.jpg', of='out', pos=10),

        to_connection("input", "conv1"),
        to_connection("conv1", "conv2"),
        to_connection("conv2", "conv3"),
        to_connection("conv3", "conv4"),

        to_connection("res_top", "up3"),
        to_connection("up3", "upsum3"),
        to_skip(of="conv3", to="upsum3", pos=1.25, pos2=1.25 + (30 / 2 - 2.5) * scale),
        to_connection("upsum3", "upconv3"),

        to_connection("upconv3", "up2"),
        to_connection("up2", "upsum2"),
        to_skip(of="conv2", to="upsum2", pos=1.25, pos2=1.25 + (35 / 2 - 2.5) * scale),
        to_connection("upsum2", "upconv2"),

        to_connection("upconv2", "up1"),
        to_connection("up1", "upsum1"),
        to_skip(of="conv1", to="upsum1", pos=1.25, pos2=1.25 + (40 / 2 - 2.5) * scale),
        to_connection("upsum1", "upconv1"),

        to_connection("upconv1", "out"),
        # to_connection("conv4", "rsb1"),
        # to_connection("rsb1", "rsb2"),
        # to_connection("rsb2", "rsb3"),
        # to_connection("rsb3", "rsb4"),

        to_end(),
    ]

    to_generate(arch, 'ForPatent.tex')

    pass


if __name__ == '__main__':
    # ForPatent()
    NLayerDiscriminator()
    # RSABUnetV1()
    # SinoUnet()
    # UNet3DCTP3()
    # ResnetGenerator()
    print('done')
